<template>
    <!-- 组件结构 -->
    <div class="school">
        <h2 @click="showName">学校名称：{{name }}</h2>
        <h2>学校地址：{{address}}</h2>
    </div>
</template>
<script>
import { getCurrentInstance } from 'vue';
import emitter from '../eventBus';
import { onUnmounted } from 'vue';

    export default {
        name: 'School',
        data(){
            return{
                name:'Polaris',
                address:'青岛'
            }
        },
        mounted(){
            
        },
        setup(){
             emitter.on('hiBro',(msg)=>{
                console.log('Hi bro, this is School.Received '+msg)
             })
             onUnmounted(()=>{
                emitter.off('hiBro') 
             })
        },
    }
</script>
<style scope>
    .school{
        background-color: skyblue;
        padding: 5px;
    }
</style>
